﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace clsPrintVariable
{
    public enum FieldTypes
    {
        DATE = 1,
        SERIAL = 2,
        TEXT =3,
        GZONE = 4,
        GRAVITYVALUE = 5,
        FLOAT = 6,
        INT = 7,
        COFORIGIN=8
    }


    public enum VisibilityType
    {
        Visible = 1,
        Hidden = 2,
        Disabled = 3,
        Enabled = 4
    }


    public partial class ucPrintVariable : UserControl
    {

        public int iIndex;

        public delegate void EventHandler(Object sender, EventArgs e);


        public event EventHandler BomItemComplete;

        public event EventHandler HandleProdOrderCheckChange ;
        public event EventHandler HandleStartingElementChange ;
        public event EventHandler HandleEndingElementChange;

        public ucPrintVariable()
        {
            InitializeComponent();
        }

        public string strVariableName
        {
            get
            {
                return this.lblVariableName.Text.ToString();
            }
            set
            {
                this.lblVariableName.Text = value;
            }
        }


        public string strStart
        {
            get
            {
                return cmbStart.SelectedText.ToString();
            }
            set
            {
                cmbStart.SelectedText = value;
            }
        }

        public System.Windows.Forms.ComboBox cmdStartCombo
        {
            get
            {
                return this.cmbStart;
            }
        }
        

        public string strEnd
        {
            get
            {
                return cmbEnd.SelectedText.ToString();
            }
            set
            {
                cmbEnd.SelectedText = value;
            }
        }


        public System.Windows.Forms.ComboBox cmbEndCombo
        {
            get
            {
                return this.cmbEnd;
            }
        }

        private VisibilityType vVisibleEnd;
        public VisibilityType enVisibleEnd
        {
            get
            {
                return vVisibleEnd;
            }
            set
            {
                vVisibleEnd = value;
                switch ((VisibilityType)value)
                {
                    case VisibilityType.Hidden:
                        this.label3.Visible = false;
                        this.cmbEnd.Visible = false;
                        break;
                    case VisibilityType.Disabled:
                        this.label3.Enabled = true;
                        this.cmbEnd.Enabled = false;
                        break;
                    case VisibilityType.Enabled:
                        this.label3.Visible = true;
                        this.cmbEnd.Visible = true;
                        this.cmbEnd.Enabled = true;
                        break;
                    case VisibilityType.Visible:
                        this.label3.Visible = true;
                        this.cmbEnd.Visible = true;
                        break;

                }

            }
        }

        public System.Windows.Forms.CheckBox chkProdOrdercheckbox
        {
            get
            {
                return this.chkProdOrder;
            }
        }

        public bool bProdOrder
        {
            get
            {
                return chkProdOrder.Checked;
            }
            set
            {
                chkProdOrder.Checked = value;

            }
        }


        private VisibilityType vProdOrder;
        public VisibilityType enProdOrder
        {
            get
            {
                return vProdOrder;
            }
            set
            {
                vProdOrder = value;
                switch ((VisibilityType)value)
                {
                    case VisibilityType.Hidden:
                        this.chkProdOrder.Visible = false;
                        break;
                    case VisibilityType.Disabled:
                        this.chkProdOrder.Enabled = false;
                        break;
                    case VisibilityType.Enabled:
                        this.chkProdOrder.Visible = true;
                        this.chkProdOrder.Enabled = true;
                        break;
                    case VisibilityType.Visible:
                        this.chkProdOrder.Visible = true;
                        break;

                }
            }
        }

        public System.Windows.Forms.Label lblStartingValueLabel
        {
            get
            {
                return this.label2;
            }
        }

        private FieldTypes myFieldType ;
        public FieldTypes aFieldType
        {
            get
            {
                return myFieldType;
            }
            set
            {
                myFieldType = value;
            }
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
           HandleEndingElementChange(this,new EventArgs()) ;
        }

        private void chkProdOrder_CheckedChanged(object sender, EventArgs e)
        {
                     HandleProdOrderCheckChange(this,new EventArgs()) ;

        }

        private void cmbStart_SelectedIndexChanged(object sender, EventArgs e)
        {
                    HandleStartingElementChange(this, new EventArgs()) ;


        }
    }
}
